package main

import "fmt"

func keys(m map[string]int) []string {
}

var _ func(m map[string]int) []string = keys

func main() {
	for _, t := range []struct {
		in   map[string]int
		want []string
	}{
		{map[string]int{"rat": 1, "cat": 2, "dog": 3}, []string{"cat", "dog", "rat"}},
		{map[string]int{"rob": 42, "ken": 78, "gri": 31}, []string{"gri", "ken", "rob"}},
	} {
		got := keys(t.in)
		if !sliceEqual(got, t.want) {
			fmt.Printf("keys(%v) produced %v, want %v\n", t.in, got, t.want)
			fmt.Println("Oh no!")
			return
		}
	}
	fmt.Println("PASS")
}

func sliceEqual(a, b []string) bool {
	if len(a) != len(b) {
		return false
	}
	for i := range a {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

/*
import "sort"

func keys(m map[string]int) []string {
	var s []string
	for k := range m {
		s = append(s, k)
	}
	sort.Strings(s)
	return s
}
*/
